


import { Component, OnInit, Input, Injector, Type, TemplateRef, ViewChild } from '@angular/core';
import { NzMessageService, NzNotificationService } from 'ng-zorro-antd';
import { DomSanitizer } from '@angular/platform-browser';
import { NgZorroPageBaseComponent } from '../../../core/ng-zorro-page-base-component/ng-zorro-page-base-component.component';
import {
  PagedResultDto, ClassInfoOutput, PagerSearchInput, HttpService, BaseComponentConfig,
  CustomNavigation, KeyValueOutput, SearchValue
} from '../../..';
import { Router, Route, ActivatedRoute } from "@angular/router";
import { map } from 'rxjs/operators';
import { MyeditorComponent } from '../../myeditor/myeditor.component';
@Component({
  selector: 'app-grill-guide',
  templateUrl: './grill-guide.component.html',
  styleUrls: ['./grill-guide.component.scss']
})
export class GrillGuideComponent extends NgZorroPageBaseComponent implements OnInit {


  gid;
  gcaption;
  academearr;
  grillbg = "";
  fwbBjq;
  id;
  subid = "";
  feedtype;
  drillSubjectId;
  courseInformation;
  subname;
  constructor(injector: Injector, private _message: NzMessageService, public sanitizer: DomSanitizer, public http: HttpService,
    public route: ActivatedRoute
  ) {
    super(injector,
      new BaseComponentConfig(

      ));
  }
  @ViewChild(MyeditorComponent) MyeditorComponent: MyeditorComponent;
  ngOnInit() {

    this.route.queryParams.subscribe(
      da => this.gid = (da['id']));

    this.route.queryParams.subscribe(
      d => this.gcaption = (d['caption']));
    const data = { "lid": this.gid, "TypeId": 2 };
    this.http.post<any>("DrillSubject/GetDrillSubjectInformation", data).then(e => {
      this.academearr = e;
      this.subid = e.id;
      this.subname = e.casebackground;

      if (this.subname === "") {

      } else {
        if (this.MyeditorComponent) { this.MyeditorComponent.setElement(this.subname); }
      }

    });





  }
  keyupHandler(event) {
    this.grillbg = event;

  }
  saveFeed() {
    if (this.grillbg === "") {
      this._message.warning("填写信息");

    } else {
      const data = {
        "id": this.subid,
        "drillSubjectId": this.gid,
        "casebackground": this.grillbg,
        "TypeId": 2

      };

      this.http.post<any>("DrillSubject/EditDrillInformation", data).then(e => {



      });
      this._message.success("保存成功");
    }

  }




  assembleHTML(strHTML: any) {
    return this.sanitizer.bypassSecurityTrustHtml(strHTML);
  }

}
